package se392.ateam2006.meetingmgmt;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.ejb.CreateException;
import javax.ejb.Remote;
import java.util.GregorianCalendar;

import se392.ateam2006.meetingmgmt.meeting.MeetingEntity;
import se392.ateam2006.meetingmgmt.meeting.Duration;
import se392.ateam2006.resourcemgmt.room.RoomEntity;
import se392.ateam2006.user.UserEntity;

/**
 * Remote interface for the MeetingMgmtBean - allows access from a different JVM
 * @author Ateam (Matthew Bennett, Claire Melton, Shingai Manyiwa, John Adderley)
 * @version 25/03/07
 */
@Remote 
public interface MeetingMgmtRemote extends Serializable {

    String getEquipmentForMeeting(String userId, String meetingId);

    void setMeetingStartPeriods(GregorianCalendar startDate, GregorianCalendar endDate, int offset);

    boolean addEquipmentConstraint(String userId, String meetingId, String equipmentType, int number);

    boolean bookTheMeeting(String meetingId, String venue, String startDate);
    
    boolean removeEquipmentRequirementsForMeeting(String meetingID);  
    
    boolean createMeeting(UserEntity initiator, String id, String title, String description,
                      GregorianCalendar startDateRange, GregorianCalendar endDateRange,
                      Duration duration, int roomSize, String equipment, RoomEntity room) throws CreateException;

    Collection<MeetingEntity> findMeetings(String userId);
    
    boolean deleteMeetingById(String id);
    
    void deleteMeeting(MeetingEntity me);
    
    void removeAllMeetings();
    
    Collection getAllMeetings();

    Collection getBookedMeetings();

    int getMeetingCount();

    void removeAllEquipment();
    
    void setMeetingAsBooked(String meetingId, boolean booked);
    
    Collection findMeetingsByInitiator(UserEntity user);
    
    MeetingEntity findMeetingById(String id);

    Duration createDuration(int days, int hours, int mins) throws CreateException;
    
    Duration findDurationByID(long id); 
    
    /**
     * Sets the value that Meetings should default to as response cutoff
     * 
     * @param aDefaultCutOffPeriod - int, the new cutoff period
     */
    void setDefaultCutOffPeriod(int aDefaultCutOffPeriod);
    
    int getDefaultOffSet();

    void setDefaultOffSet(int aDefaultOffSet);
    
    void setWorkingDayEnd(GregorianCalendar date);
    //New method used by startApplication.java added by mcs3 sac4
    void setWorkingDayStart(GregorianCalendar date);
   //New method used by startApplication.java added by mcs3 sac4
    void setWorkingDays(String days);  
    
    void setDefaultWorkingDayStart(GregorianCalendar aDefaultWorkingDayStart);
    
    void setDefaultWorkingDayEnd(GregorianCalendar aDefaultWorkingDayEnd);
    
    
    /**
     * Finds the best time for a meeting and returns a collection of start times
     * 
     * @param meetingId - the id of the meeting
     * @return Collection - the collection of start times
     */
    Collection<MeetingCandidate> resolveMeetingTime(String meetingId);

    int getDurationInMins(Duration duration);

}
